*     *****************************************************************   *;
*     *****************************************************************   *; 
*   Date:          December 27, 2021                               	      *;
*   Authors:       Lisa Dellmuth and Jonas Tallberg				          *;   
*   Purpose: 	   Analyses for book Legitimacy Politics: Elite  		  *;
*    Communication and Public Opinion in Global Governance (CUP, 2023)    *;
*     ****************************************************************    *;
*     ****************************************************************    *;


version 14.2

set more off

use Elitecom.dta, clear

*     ****************************************************************  *;
*     Appendix for Chapter 4									        *;
*     ****************************************************************  *;



*     ****************************************************************  *;
*     Replicate Appendix C										        *;
*     ****************************************************************  *;
		  
*B1
by country, sort:sum age
by country, sort:sum lr
by country, sort:sum trust
by country, sort:sum govc
by country, sort:sum discuss

by country, sort:tab edu
by country, sort:sum edu
by country, sort:tab gender
by country, sort:sum gender
by country, sort:tab cosmo
by country, sort:sum cosmo


*B2		  
by io5, sort:sum exar
by io5, sort:sum exbr
by io5, sort:sum excr
by io5, sort:sum exdr
by io5, sort:sum exer
by io5, sort:sum exfr
by io5, sort:sum exgr
by io5, sort:sum exhr
by io5, sort:sum exir
by io5, sort:sum exjr
by io5, sort:sum exkr
by io5, sort:sum exlr
by io5, sort:sum exmr




*     ****************************************************************  *;
*     Replicate Appendix D										        *;
*     ****************************************************************  *;

use WVS_Cross-national_Wave_7_Stata_v20200307.dta, clear // replication data from Dellmuth et al. 2021 in APSR

*Descriptive stats for elite credibility

*use wvs 7th wave data

tab B_COUNTRY
tab B_COUNTRY, nol

*UK not a part of 6th wave

*ger: 276
*UK: 826
*US: 840

women: Q79
env: Q80
gov: Q71
Q83: UN
Q84: IMF
Q85: ICC
Q86: NATO
Q87: World Bank
Q88: WHO
Q89: WTO

tab Q79
tab Q89, nol

recode Q71 (1=3) (3=1) (4=0), gen(conf_gov)
recode Q80 (1=3) (3=1) (4=0), gen(conf_env_protectionmovement)
recode Q79 (1=3) (3=1) (4=0), gen(conf_womensmovement)
recode Q83 (1=3) (3=1) (4=0), gen(conf_un)
recode Q84 (1=3) (3=1) (4=0), gen(conf_imf)
recode Q85 (1=3) (3=1) (4=0), gen(conf_icc)
recode Q86 (1=3) (3=1) (4=0), gen(conf_nato)
recode Q87 (1=3) (3=1) (4=0), gen(conf_wb)
recode Q88 (1=3) (3=1) (4=0), gen(conf_who)
recode Q89 (1=3) (3=1) (4=0), gen(conf_wto)

*environment vs government
**************************************
*use a paired t-test to determine whether the mean difference between two groups is statistically significantly different to zero.
ttest conf_env_protectionmovement== conf_gov

/*A paired t-test t-test shows that the mean difference between two groups is statistically 
significantly different from zero. At the 1% level. Mean difference of 0.281, whereby mean confidence in environmental protection movement
is higher than mean confidence in government.
Performed using WVS 7th wave data, 52 countries among 66973 people. 
*/

tab B_COUNTRY if conf_env_protectionmovement!=.&conf_gov!=.

*women vs government
**************************************
ttest conf_womensmovement== conf_gov

tab B_COUNTRY if conf_womensmovement!=.&conf_gov!=.


*environment vs UN
**************************************
*use a paired t-test to determine whether the mean difference between two groups is statistically significantly different to zero.
ttest conf_env_protectionmovement== conf_un

tab B_COUNTRY if conf_env_protectionmovement!=.&conf_un!=.


*women vs UN
**************************************
ttest conf_womensmovement== conf_un


tab B_COUNTRY if conf_womensmovement!=.&conf_un!=.

*gov vs UN
**************************************
ttest conf_gov== conf_un
 
tab B_COUNTRY if conf_gov!=.&conf_un!=.


*WVS6

use WVS_Longitudinal_1981_2014_stata_v2015_04_18.dta, clear

keep if S002==6

recode E069_11 (-5/-1=.) (1=3) (3=1) (4=0), gen(conf_gov)
recode E069_14 (-5/-1=.) (1=3) (3=1) (4=0), gen(conf_env_protectionmovement)
recode E069_15 (-5/-1=.) (1=3) (3=1) (4=0), gen(conf_womensmovement) 
recode E069_20 (-5/-1=.) (1=3) (3=1) (4=0), gen(conf_un) 

ttest conf_env_protectionmovement== conf_gov
ttest conf_womensmovement== conf_gov
ttest conf_env_protectionmovement== conf_un
ttest conf_womensmovement== conf_un
ttest conf_gov== conf_un

tab S003 if conf_env_protectionmovement!=.&conf_gov!=.
tab S003 if conf_womensmovement!=.&conf_gov!=.
tab S003 if conf_env_protectionmovement!=.&conf_un!=.
tab S003 if conf_womensmovement!=.&conf_un!=.
tab S003 if conf_gov!=.&conf_un!=.









*     ****************************************************************  *;
*     Replicate table E1: elite type 									*;
*     ****************************************************************  *;


*generate dummies to test treatment groups vs control group
gen t_cso_p=.
gen t_cso_n=.
gen t_io_p=.
gen t_io_n=.
gen t_gov_p=.
gen t_gov_n=.

replace t_cso_p =0 if exmr ~=.
replace t_cso_p =1 if exar ~=.|excr ~=.

replace t_cso_n =0 if exmr ~=.
replace t_cso_n =1 if exbr ~=.|exdr ~=.

replace t_io_p =0 if exmr ~=.
replace t_io_p =1 if exer ~=.|exgr ~=.

replace t_io_n =0 if exmr ~=.
replace t_io_n =1 if exfr ~=.|exhr ~=.

replace t_gov_p =0 if exmr ~=.
replace t_gov_p =1 if exir ~=.|exkr ~=.

replace t_gov_n =0 if exmr ~=.
replace t_gov_n =1 if exjr ~=.|exlr ~=.


*generate dummies to test treatment groups vs treatment groups
gen t_cso_io_p=.
gen t_cso_io_n=. 
gen t_cso_gov_p=.
gen t_cso_gov_n=. 
gen t_io_gov_p=.
gen t_io_gov_n=. 
gen t_gov_io_p=.
gen t_gov_io_n=.

replace t_cso_io_p =0 if exer ~=.|exgr ~=.
replace t_cso_io_p =1 if exar ~=.|excr ~=.

replace t_cso_io_n =0 if exfr ~=.|exhr ~=.
replace t_cso_io_n =1 if exbr ~=.|exdr ~=.

replace t_gov_io_p =0 if exer ~=.|exgr ~=.
replace t_gov_io_p =1 if exir ~=.|exkr ~=.

replace t_gov_io_n =0 if exfr ~=.|exhr ~=.
replace t_gov_io_n =1 if exjr ~=.|exlr ~=.

replace t_cso_gov_p =0 if exir ~=.|exkr ~=.
replace t_cso_gov_p =1 if exar ~=.|excr ~=.

replace t_cso_gov_n =0 if exjr ~=.|exlr ~=.
replace t_cso_gov_n =1 if exbr ~=.|exdr ~=.


set more off

reg conf t_cso_p i.country  [aw=weight],  cluster(id)
eststo csop

reg conf t_cso_n i.country [aw=weight],  cluster(id)
eststo cson

reg conf t_io_p i.country [aw=weight],  cluster(id)
eststo iop

reg conf t_io_n i.country [aw=weight],  cluster(id)
eststo ion

reg conf t_gov_p i.country [aw=weight],  cluster(id)
eststo govp

reg conf t_gov_n i.country [aw=weight],  cluster(id)
eststo govn

reg conf t_cso_io_p  i.country [aw=weight],  cluster(id)
eststo csoiop

reg conf t_cso_io_n i.country [aw=weight],  cluster(id)
eststo csoion

reg conf t_gov_io_p i.country [aw=weight],  cluster(id)
eststo goviop

reg conf t_gov_io_n i.country [aw=weight],  cluster(id)
eststo govion

reg conf t_cso_gov_p i.country [aw=weight],  cluster(id)
eststo csogovp

reg conf t_cso_gov_n i.country [aw=weight],  cluster(id)
eststo csogovn



esttab csop cson iop ion govp govn ///
 using tableD1-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars

esttab csoiop csoion goviop govion csogovp csogovn  ///
 using tableD1contd-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars




*     ****************************************************************  *;
*     Replicate table E2: input vs output 								*;
*     ****************************************************************  *;


*generate dummies to test treatment groups vs control group
gen t_in_p=.
gen t_out_p=.
gen t_in_n=.
gen t_out_n=.

replace t_in_p =0 if exmr ~=.
replace t_in_p =1 if exar ~=.|exer ~=.|exir ~=.

replace t_out_p =0 if exmr ~=.
replace t_out_p =1 if excr ~=.|exgr ~=.|exkr ~=.

replace t_in_n =0 if exmr ~=.
replace t_in_n =1 if exbr ~=.|exfr ~=.|exjr ~=.

replace t_out_n =0 if exmr ~=.
replace t_out_n =1 if exdr ~=.|exhr ~=.|exlr ~=.


*generate dummies to test treatment groups vs treatment groups
gen t_in_out_p=.
gen t_in_out_n=. 

replace t_in_out_p =0 if excr ~=.|exgr ~=.|exkr ~=.
replace t_in_out_p =1 if exar ~=.|exer ~=.|exir ~=.

replace t_in_out_n =0 if exdr ~=.|exhr ~=.|exlr ~=.
replace t_in_out_n =1 if exbr ~=.|exfr ~=.|exjr ~=.


set more off

reg conf t_in_p i.country [aw=weight], cluster(id)
eststo inp

reg conf t_in_n i.country [aw=weight], cluster(id)
eststo inn

reg conf t_out_p i.country [aw=weight], cluster(id)
eststo outp

reg conf t_out_n i.country [aw=weight], cluster(id)
eststo outn

reg conf t_in_out_p i.country [aw=weight], cluster(id)
eststo inoutp

reg conf t_in_out_n i.country [aw=weight], cluster(id)
eststo inoutn


esttab inp inn outp outn inoutp inoutn ///
 using tableD2-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars





*     ****************************************************************  *;
*     Replicate table E3: valence 									    *;
*     ****************************************************************  *;

*generate dummies to test treatment groups vs control group
gen t_p=.
gen t_n=. 

replace t_p =0 if exmr ~=.
replace t_p =1 if exar ~=.|excr ~=.|exer ~=.|exgr ~=.|exir ~=.|exkr ~=. 

replace t_n =0 if exmr ~=.
replace t_n =1 if exbr ~=.|exdr ~=.|exfr ~=.|exhr ~=.|exjr ~=.|exlr ~=. 

*generate dummy to test treatment groups vs treatment groups

gen t_pn=.
replace t_pn =1 if exbr ~=.|exdr ~=.|exfr ~=.|exhr ~=.|exjr ~=.|exlr ~=.
replace t_pn =0 if exar ~=.|excr ~=.|exer ~=.|exgr ~=.|exir ~=.|exkr ~=. 

set more off

reg conf t_p i.country [aw=weight],  cluster(id)
eststo pos

reg conf t_n i.country [aw=weight],  cluster(id)
eststo neg

reg conf t_pn i.country [aw=weight], cluster(id)
eststo posneg 



esttab pos neg posneg ///
 using tableD3-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars


*Significance test comparing regression coefficients for positive and negative
*treatment, i.e. of two independent samples
*     ****************************************************************  *;

*t_obs=(b1-b2)/sqrt(se(b1)^2+se(b2)^2)​

*Difference between absolute sizes is calculated due to the hypothesis that
*negative treatment has a stronger effect than positive treatment. Here, b1=negative
*effect and b2=positive effect, so hypothesis is abs(b1)>b2.  
display (.320+.198)
display (.320+.198)/sqrt(.06^2+0.059^2)
*b3==.518 and t=6.1557711, df=n-1=2
*ignificant at 5%



		   
*     ****************************************************************  *;
*     Replicate Appendix E.4: numerical results for Fig. 4.4-4.6	    *;
*     ****************************************************************  *;


set more off

reg conf t_cso_p i.country  [aw=weight],  cluster(id)
eststo csop

reg conf t_cso_n i.country [aw=weight],  cluster(id)
eststo cson

reg conf t_io_p i.country [aw=weight],  cluster(id)
eststo iop

reg conf t_io_n i.country [aw=weight],  cluster(id)
eststo ion

reg conf t_gov_p i.country [aw=weight],  cluster(id)
eststo govp

reg conf t_gov_n i.country [aw=weight],  cluster(id)
eststo govn

reg conf t_cso_io_p i.country  [aw=weight],  cluster(id)
eststo csoiop

reg conf t_cso_io_n i.country [aw=weight],  cluster(id)
eststo csoion

reg conf t_gov_io_p i.country [aw=weight],  cluster(id)
eststo goviop

reg conf t_gov_io_n i.country [aw=weight],  cluster(id)
eststo govion

reg conf t_cso_gov_p i.country [aw=weight],  cluster(id)
eststo csogovp

reg conf t_cso_gov_n i.country [aw=weight],  cluster(id)
eststo csogovn



esttab csop cson iop ion govp govn ///
 using tableD1-weighted-countrydummies.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars

esttab csoiop csoion goviop govion csogovp csogovn  ///
 using tableD1contd-weighted-countrydummies.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars



set more off

reg conf t_in_p i.country [aw=weight], cluster(id)
eststo inp

reg conf t_in_n i.country [aw=weight], cluster(id)
eststo inn

reg conf t_out_p i.country [aw=weight], cluster(id)
eststo outp

reg conf t_out_n i.country [aw=weight], cluster(id)
eststo outn

reg conf t_in_out_p i.country [aw=weight], cluster(id)
eststo inoutp

reg conf t_in_out_n i.country [aw=weight], cluster(id)
eststo inoutn



esttab inp inn outp outn inoutp inoutn ///
 using tableD2-weighted-countrydummies.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars



set more off

reg conf t_p i.country [aw=weight],  cluster(id)
eststo pos

reg conf t_n i.country [aw=weight],  cluster(id)
eststo neg

reg conf t_pn i.country [aw=weight],  cluster(id)
eststo posneg

esttab pos neg posneg ///
 using tableD3-weighted-countrydummies.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars




set more off


***UN

reg conf t_cso_p i.country if io==1 [aw=weight],  cluster(id)
eststo csop

reg conf t_cso_n i.country if io==1 [aw=weight],  cluster(id)
eststo cson

reg conf t_io_p i.country if io==1 [aw=weight],  cluster(id)
eststo iop

reg conf t_io_n i.country if io==1 [aw=weight],  cluster(id)
eststo ion

reg conf t_gov_p i.country if io==1 [aw=weight],  cluster(id)
eststo govp

reg conf t_gov_n i.country if io==1 [aw=weight],  cluster(id)
eststo govn

***

reg conf t_in_p i.country if io==1 [aw=weight], cluster(id)
eststo inp

reg conf t_in_n i.country if io==1 [aw=weight], cluster(id)
eststo inn

reg conf t_out_p i.country if io==1 [aw=weight], cluster(id)
eststo outp

reg conf t_out_n i.country if io==1 [aw=weight], cluster(id)
eststo outn


***

reg conf t_p i.country if io==1 [aw=weight],  cluster(id)
eststo pos

reg conf t_n i.country if io==1 [aw=weight],  cluster(id)
eststo neg
 

esttab  csop cson iop ion govp govn inp inn outp outn pos neg ///
using  un-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars


***IMF

set more off



reg conf t_cso_p i.country if io==4 [aw=weight],  cluster(id)
eststo csop

reg conf t_cso_n i.country if io==4 [aw=weight],  cluster(id)
eststo cson

reg conf t_io_p i.country if io==4 [aw=weight],  cluster(id)
eststo iop

reg conf t_io_n i.country if io==4 [aw=weight],  cluster(id)
eststo ion

reg conf t_gov_p i.country if io==4 [aw=weight],  cluster(id)
eststo govp

reg conf t_gov_n i.country if io==4 [aw=weight],  cluster(id)
eststo govn
 


***

reg conf t_in_p i.country if io==4 [aw=weight],  cluster(id)
eststo inp

reg conf t_in_n i.country if io==4 [aw=weight],  cluster(id)
eststo inn

reg conf t_out_p i.country if io==4 [aw=weight],  cluster(id)
eststo outp

reg conf t_out_n i.country if io==4 [aw=weight],  cluster(id)
eststo outn
 

***

reg conf t_p i.country if io==4 [aw=weight],  cluster(id)
eststo pos

reg conf t_n i.country if io==4 [aw=weight],  cluster(id)
eststo neg
 

esttab csop cson iop ion govp govn inp inn outp outn pos neg  ///
using  imf-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars




***WTO

set more off

reg conf t_cso_p i.country if io==5 [aw=weight],  cluster(id)
eststo csop

reg conf t_cso_n i.country if io==5 [aw=weight],  cluster(id)
eststo cson

reg conf t_io_p i.country if io==5 [aw=weight],  cluster(id)
eststo iop

reg conf t_io_n i.country if io==5 [aw=weight],  cluster(id)
eststo ion

reg conf t_gov_p i.country if io==5 [aw=weight],  cluster(id)
eststo govp

reg conf t_gov_n i.country if io==5 [aw=weight],  cluster(id)
eststo govn 


***

reg conf t_in_p i.country if io==5 [aw=weight],  cluster(id)
eststo inp

reg conf t_in_n i.country if io==5 [aw=weight],  cluster(id)
eststo inn

reg conf t_out_p i.country if io==5 [aw=weight],  cluster(id)
eststo outp

reg conf t_out_n i.country if io==5 [aw=weight],  cluster(id)
eststo outn 

***
reg conf t_p i.country if io==5 [aw=weight],  cluster(id)
eststo pos

reg conf t_n i.country if io==5 [aw=weight],  cluster(id)
eststo neg
 

esttab csop cson iop ion inp inn outp outn govp govn pos neg  ///
using wto-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars



***EU

set more off


reg conf t_cso_p  i.country if io==2 [aw=weight],  cluster(id)
eststo csop

reg conf t_cso_n  i.country if io==2 [aw=weight],  cluster(id)
eststo cson

reg conf t_io_p  i.country if io==2 [aw=weight],  cluster(id)
eststo iop

reg conf t_io_n  i.country if io==2 [aw=weight],  cluster(id)
eststo ion

reg conf t_gov_p  i.country if io==2 [aw=weight],  cluster(id)
eststo govp

reg conf t_gov_n  i.country if io==2 [aw=weight],  cluster(id)
eststo govn
 


***

reg conf t_in_p i.country if io==2 [aw=weight],  cluster(id)
eststo inp

reg conf t_in_n  i.country if io==2 [aw=weight],  cluster(id)
eststo inn

reg conf t_out_p  i.country if io==2 [aw=weight],  cluster(id)
eststo outp

reg conf t_out_n  i.country if io==2 [aw=weight],  cluster(id)
eststo outn
 
***
reg conf t_p  i.country if io==2 [aw=weight],  cluster(id)
eststo pos

reg conf t_n  i.country if io==2 [aw=weight],  cluster(id)
eststo neg
 


esttab csop cson iop ion govp govn  inp inn outp outn pos neg  ///
using eu-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars



***NAFTA

set more off



reg conf t_cso_p  i.country if io==3 [aw=weight],  cluster(id)
eststo csop

reg conf t_cso_n  i.country if io==3 [aw=weight],  cluster(id)
eststo cson

reg conf t_io_p  i.country if io==3 [aw=weight],  cluster(id)
eststo iop

reg conf t_io_n  i.country if io==3 [aw=weight],  cluster(id)
eststo ion

reg conf t_gov_p  i.country if io==3 [aw=weight],  cluster(id)
eststo govp

reg conf t_gov_n  i.country if io==3 [aw=weight],  cluster(id)
eststo govn


***

reg conf t_in_p i.country if io==3 [aw=weight],  cluster(id)
eststo inp

reg conf t_in_n  i.country if io==3 [aw=weight],  cluster(id)
eststo inn

reg conf t_out_p  i.country if io==3 [aw=weight],  cluster(id)
eststo outp

reg conf t_out_n  i.country if io==3 [aw=weight],  cluster(id)
eststo outn

***
reg conf t_p  i.country if io==3 [aw=weight],  cluster(id)
eststo pos

reg conf t_n  i.country if io==3 [aw=weight],  cluster(id)
eststo neg

esttab csop cson iop ion govp govn inp inn outp outn pos neg ///
using nafta-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars

 
 
 

 
 

*     ****************************************************************  *;
*     Appendix F: Balance tests  								        *;
*     ****************************************************************  *;
 
 


putexcel set "T-test_all1.xlsx", sheet("t_test") replace
putexcel A1=("Ha: diff != 0")
putexcel B1=("Ha: diff != 0")
putexcel C1=("Ha: diff != 0")
putexcel D1=("Ha: diff != 0")
putexcel E1=("Ha: diff != 0")
putexcel F1=("Ha: diff != 0")
putexcel G1=("Ha: diff != 0")
putexcel H1=("Ha: diff != 0")

local row=2
ttest edu , by(t_in_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=3
ttest edu , by(t_in_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=4
ttest edu , by(t_out_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=5
ttest edu , by(t_out_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=7
ttest edu , by(t_cso_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=8
ttest edu , by(t_cso_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=9
ttest edu , by(t_io_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=10
ttest edu , by(t_io_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=11
ttest edu , by(t_gov_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=12
ttest edu , by(t_gov_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=14
ttest edu , by(t_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=15
ttest edu , by(t_n)
putexcel A`row' = (r(p))  , nformat(number_d2)



local row=2
ttest age , by(t_in_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=3
ttest age , by(t_in_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=4
ttest age , by(t_out_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=5
ttest age , by(t_out_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=7
ttest age , by(t_cso_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=8
ttest age , by(t_cso_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=9
ttest age , by(t_io_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=10
ttest age , by(t_io_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=11
ttest age , by(t_gov_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=12
ttest age , by(t_gov_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=14
ttest age , by(t_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=15
ttest age , by(t_n)
putexcel B`row' = (r(p))  , nformat(number_d2)



local row=2
ttest gender , by(t_in_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=3
ttest gender , by(t_in_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=4
ttest gender , by(t_out_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=5
ttest gender , by(t_out_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=7
ttest gender , by(t_cso_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=8
ttest gender , by(t_cso_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=9
ttest gender , by(t_io_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=10
ttest gender , by(t_io_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=11
ttest gender , by(t_gov_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=12
ttest gender , by(t_gov_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=14
ttest gender , by(t_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=15
ttest gender , by(t_n)
putexcel C`row' = (r(p))  , nformat(number_d2)



local row=2
ttest lr , by(t_in_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=3
ttest lr , by(t_in_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=4
ttest lr , by(t_out_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=5
ttest lr , by(t_out_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=7
ttest lr , by(t_cso_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=8
ttest lr , by(t_cso_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=9
ttest lr , by(t_io_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=10
ttest lr , by(t_io_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=11
ttest lr , by(t_gov_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=12
ttest lr , by(t_gov_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=14
ttest lr , by(t_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=15
ttest lr , by(t_n)
putexcel D`row' = (r(p))  , nformat(number_d2)



local row=2
ttest trust , by(t_in_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=3
ttest trust , by(t_in_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=4
ttest trust , by(t_out_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=5
ttest trust , by(t_out_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=7
ttest trust , by(t_cso_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=8
ttest trust , by(t_cso_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=9
ttest trust , by(t_io_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=10
ttest trust , by(t_io_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=11
ttest trust , by(t_gov_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=12
ttest trust , by(t_gov_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=14
ttest trust , by(t_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=15
ttest trust , by(t_n)
putexcel E`row' = (r(p))  , nformat(number_d2)



local row=2
ttest cosmo , by(t_in_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=3
ttest cosmo , by(t_in_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=4
ttest cosmo , by(t_out_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=5
ttest cosmo , by(t_out_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=7
ttest cosmo , by(t_cso_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=8
ttest cosmo , by(t_cso_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=9
ttest cosmo , by(t_io_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=10
ttest cosmo , by(t_io_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=11
ttest cosmo , by(t_gov_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=12
ttest cosmo , by(t_gov_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=14
ttest cosmo , by(t_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=15
ttest cosmo , by(t_n)
putexcel F`row' = (r(p))  , nformat(number_d2)



local row=2
ttest govc , by(t_in_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=3
ttest govc , by(t_in_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=4
ttest govc , by(t_out_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=5
ttest govc , by(t_out_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=7
ttest govc , by(t_cso_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=8
ttest govc , by(t_cso_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=9
ttest govc , by(t_io_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=10
ttest govc , by(t_io_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=11
ttest govc , by(t_gov_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=12
ttest govc , by(t_gov_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=14
ttest govc , by(t_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=15
ttest govc , by(t_n)
putexcel G`row' = (r(p))  , nformat(number_d2)



local row=2
ttest discuss , by(t_in_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=3
ttest discuss , by(t_in_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=4
ttest discuss , by(t_out_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=5
ttest discuss , by(t_out_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=7
ttest discuss , by(t_cso_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=8
ttest discuss , by(t_cso_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=9
ttest discuss , by(t_io_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=10
ttest discuss , by(t_io_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=11
ttest discuss , by(t_gov_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=12
ttest discuss , by(t_gov_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=14
ttest discuss , by(t_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=15
ttest discuss , by(t_n)
putexcel H`row' = (r(p))  , nformat(number_d2)





***

tab exmr
tab exar

gen exar1 =0 if exmr ~=.
replace exar1 =1 if exar ~=.

gen exbr1 =0 if exmr ~=.
replace exbr1 =1 if exbr ~=.

gen excr1 =0 if exmr ~=.
replace excr1 =1 if excr ~=.

gen exdr1 =0 if exmr ~=.
replace exdr1 =1 if exdr ~=.

gen exer1 =0 if exmr ~=.
replace exer1 =1 if exer ~=.

gen exfr1 =0 if exmr ~=.
replace exfr1 =1 if exfr ~=.

gen exgr1 =0 if exmr ~=.
replace exgr1 =1 if exgr ~=.

gen exhr1 =0 if exmr ~=.
replace exhr1 =1 if exhr ~=.

gen exir1 =0 if exmr ~=.
replace exir1 =1 if exir ~=.

gen exjr1 =0 if exmr ~=.
replace exjr1 =1 if exjr ~=.

gen exkr1 =0 if exmr ~=.
replace exkr1 =1 if exkr ~=.

gen exlr1 =0 if exmr ~=.
replace exlr1 =1 if exlr ~=.



putexcel set "T-test_all2.xlsx", sheet("t_test") replace
putexcel A1=("Ha: diff != 0")
putexcel B1=("Ha: diff != 0")
putexcel C1=("Ha: diff != 0")
putexcel D1=("Ha: diff != 0")
putexcel E1=("Ha: diff != 0")
putexcel F1=("Ha: diff != 0")
putexcel G1=("Ha: diff != 0")
putexcel H1=("Ha: diff != 0")

local row=2
ttest edu , by(exar1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=3
ttest edu , by(exbr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=4
ttest edu , by(excr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=5
ttest edu , by(exdr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=6
ttest edu , by(exer1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=7
ttest edu , by(exfr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=8
ttest edu , by(exgr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=9
ttest edu , by(exhr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=10
ttest edu , by(exir1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=11
ttest edu , by(exjr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=12
ttest edu , by(exkr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=13
ttest edu , by(exlr1)
putexcel A`row' = (r(p))  , nformat(number_d2)


local row=2
ttest age , by(exar1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=3
ttest age , by(exbr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=4
ttest age , by(excr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=5
ttest age , by(exdr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=6
ttest age , by(exer1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=7
ttest age , by(exfr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=8
ttest age , by(exgr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=9
ttest age , by(exhr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=10
ttest age , by(exir1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=11
ttest age , by(exjr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=12
ttest age , by(exkr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=13
ttest age , by(exlr1)
putexcel B`row' = (r(p))  , nformat(number_d2)


local row=2
ttest gender , by(exar1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=3
ttest gender , by(exbr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=4
ttest gender , by(excr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=5
ttest gender , by(exdr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=6
ttest gender , by(exer1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=7
ttest gender , by(exfr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=8
ttest gender , by(exgr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=9
ttest gender , by(exhr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=10
ttest gender , by(exir1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=11
ttest gender , by(exjr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=12
ttest gender , by(exkr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=13
ttest gender , by(exlr1)
putexcel C`row' = (r(p))  , nformat(number_d2)


local row=2
ttest lr , by(exar1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=3
ttest lr , by(exbr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=4
ttest lr , by(excr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=5
ttest lr , by(exdr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=6
ttest lr , by(exer1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=7
ttest lr , by(exfr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=8
ttest lr , by(exgr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=9
ttest lr , by(exhr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=10
ttest lr , by(exir1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=11
ttest lr , by(exjr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=12
ttest lr , by(exkr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=13
ttest lr , by(exlr1)
putexcel D`row' = (r(p))  , nformat(number_d2)


local row=2
ttest trust , by(exar1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=3
ttest trust , by(exbr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=4
ttest trust , by(excr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=5
ttest trust , by(exdr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=6
ttest trust , by(exer1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=7
ttest trust , by(exfr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=8
ttest trust , by(exgr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=9
ttest trust , by(exhr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=10
ttest trust , by(exir1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=11
ttest trust , by(exjr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=12
ttest trust , by(exkr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=13
ttest trust , by(exlr1)
putexcel E`row' = (r(p))  , nformat(number_d2)


local row=2
ttest cosmo , by(exar1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=3
ttest cosmo , by(exbr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=4
ttest cosmo , by(excr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=5
ttest cosmo , by(exdr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=6
ttest cosmo , by(exer1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=7
ttest cosmo , by(exfr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=8
ttest cosmo , by(exgr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=9
ttest cosmo , by(exhr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=10
ttest cosmo , by(exir1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=11
ttest cosmo , by(exjr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=12
ttest cosmo , by(exkr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=13
ttest cosmo , by(exlr1)
putexcel F`row' = (r(p))  , nformat(number_d2)


local row=2
ttest govc , by(exar1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=3
ttest govc , by(exbr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=4
ttest govc , by(excr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=5
ttest govc , by(exdr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=6
ttest govc , by(exer1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=7
ttest govc , by(exfr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=8
ttest govc , by(exgr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=9
ttest govc , by(exhr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=10
ttest govc , by(exir1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=11
ttest govc , by(exjr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=12
ttest govc , by(exkr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=13
ttest govc , by(exlr1)
putexcel G`row' = (r(p))  , nformat(number_d2)


local row=2
ttest discuss , by(exar1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=3
ttest discuss , by(exbr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=4
ttest discuss , by(excr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=5
ttest discuss , by(exdr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=6
ttest discuss , by(exer1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=7
ttest discuss , by(exfr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=8
ttest discuss , by(exgr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=9
ttest discuss , by(exhr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=10
ttest discuss , by(exir1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=11
ttest discuss , by(exjr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=12
ttest discuss , by(exkr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=13
ttest discuss , by(exlr1)
putexcel H`row' = (r(p))  , nformat(number_d2)


******By round: UN, round 1

tab io


putexcel set "T-test_UN1.xlsx", sheet("t_test") replace
putexcel A1=("Ha: diff != 0")
putexcel B1=("Ha: diff != 0")
putexcel C1=("Ha: diff != 0")
putexcel D1=("Ha: diff != 0")
putexcel E1=("Ha: diff != 0")
putexcel F1=("Ha: diff != 0")
putexcel G1=("Ha: diff != 0")
putexcel H1=("Ha: diff != 0")

local row=2
ttest edu if io==1, by(t_in_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=3
ttest edu if io==1, by(t_in_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=4
ttest edu if io==1, by(t_out_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=5
ttest edu if io==1, by(t_out_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=7
ttest edu if io==1, by(t_cso_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=8
ttest edu if io==1, by(t_cso_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=9
ttest edu if io==1, by(t_io_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=10
ttest edu if io==1, by(t_io_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=11
ttest edu if io==1, by(t_gov_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=12
ttest edu if io==1, by(t_gov_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=14
ttest edu if io==1, by(t_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=15
ttest edu if io==1, by(t_n)
putexcel A`row' = (r(p))  , nformat(number_d2)



local row=2
ttest age if io==1, by(t_in_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=3
ttest age if io==1, by(t_in_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=4
ttest age if io==1, by(t_out_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=5
ttest age if io==1, by(t_out_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=7
ttest age if io==1, by(t_cso_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=8
ttest age if io==1, by(t_cso_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=9
ttest age if io==1, by(t_io_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=10
ttest age if io==1, by(t_io_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=11
ttest age if io==1, by(t_gov_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=12
ttest age if io==1, by(t_gov_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=14
ttest age if io==1, by(t_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=15
ttest age if io==1, by(t_n)
putexcel B`row' = (r(p))  , nformat(number_d2)



local row=2
ttest gender if io==1, by(t_in_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=3
ttest gender if io==1, by(t_in_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=4
ttest gender if io==1, by(t_out_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=5
ttest gender if io==1, by(t_out_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=7
ttest gender if io==1, by(t_cso_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=8
ttest gender if io==1, by(t_cso_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=9
ttest gender if io==1, by(t_io_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=10
ttest gender if io==1, by(t_io_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=11
ttest gender if io==1, by(t_gov_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=12
ttest gender if io==1, by(t_gov_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=14
ttest gender if io==1, by(t_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=15
ttest gender if io==1, by(t_n)
putexcel C`row' = (r(p))  , nformat(number_d2)



local row=2
ttest lr if io==1, by(t_in_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=3
ttest lr if io==1, by(t_in_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=4
ttest lr if io==1, by(t_out_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=5
ttest lr if io==1, by(t_out_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=7
ttest lr if io==1, by(t_cso_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=8
ttest lr if io==1, by(t_cso_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=9
ttest lr if io==1, by(t_io_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=10
ttest lr if io==1, by(t_io_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=11
ttest lr if io==1, by(t_gov_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=12
ttest lr if io==1, by(t_gov_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=14
ttest lr if io==1, by(t_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=15
ttest lr if io==1, by(t_n)
putexcel D`row' = (r(p))  , nformat(number_d2)



local row=2
ttest trust if io==1, by(t_in_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=3
ttest trust if io==1, by(t_in_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=4
ttest trust if io==1, by(t_out_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=5
ttest trust if io==1, by(t_out_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=7
ttest trust if io==1, by(t_cso_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=8
ttest trust if io==1, by(t_cso_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=9
ttest trust if io==1, by(t_io_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=10
ttest trust if io==1, by(t_io_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=11
ttest trust if io==1, by(t_gov_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=12
ttest trust if io==1, by(t_gov_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=14
ttest trust if io==1, by(t_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=15
ttest trust if io==1, by(t_n)
putexcel E`row' = (r(p))  , nformat(number_d2)



local row=2
ttest cosmo if io==1, by(t_in_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=3
ttest cosmo if io==1, by(t_in_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=4
ttest cosmo if io==1, by(t_out_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=5
ttest cosmo if io==1, by(t_out_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=7
ttest cosmo if io==1, by(t_cso_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=8
ttest cosmo if io==1, by(t_cso_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=9
ttest cosmo if io==1, by(t_io_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=10
ttest cosmo if io==1, by(t_io_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=11
ttest cosmo if io==1, by(t_gov_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=12
ttest cosmo if io==1, by(t_gov_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=14
ttest cosmo if io==1, by(t_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=15
ttest cosmo if io==1, by(t_n)
putexcel F`row' = (r(p))  , nformat(number_d2)



local row=2
ttest govc if io==1, by(t_in_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=3
ttest govc if io==1, by(t_in_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=4
ttest govc if io==1, by(t_out_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=5
ttest govc if io==1, by(t_out_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=7
ttest govc if io==1, by(t_cso_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=8
ttest govc if io==1, by(t_cso_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=9
ttest govc if io==1, by(t_io_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=10
ttest govc if io==1, by(t_io_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=11
ttest govc if io==1, by(t_gov_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=12
ttest govc if io==1, by(t_gov_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=14
ttest govc if io==1, by(t_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=15
ttest govc if io==1, by(t_n)
putexcel G`row' = (r(p))  , nformat(number_d2)



local row=2
ttest discuss if io==1, by(t_in_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=3
ttest discuss if io==1, by(t_in_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=4
ttest discuss if io==1, by(t_out_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=5
ttest discuss if io==1, by(t_out_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=7
ttest discuss if io==1, by(t_cso_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=8
ttest discuss if io==1, by(t_cso_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=9
ttest discuss if io==1, by(t_io_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=10
ttest discuss if io==1, by(t_io_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=11
ttest discuss if io==1, by(t_gov_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=12
ttest discuss if io==1, by(t_gov_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=14
ttest discuss if io==1, by(t_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=15
ttest discuss if io==1, by(t_n)
putexcel H`row' = (r(p))  , nformat(number_d2)




***



putexcel set "T-test_UN2.xlsx", sheet("t_test") replace
putexcel A1=("Ha: diff != 0")
putexcel B1=("Ha: diff != 0")
putexcel C1=("Ha: diff != 0")
putexcel D1=("Ha: diff != 0")
putexcel E1=("Ha: diff != 0")
putexcel F1=("Ha: diff != 0")
putexcel G1=("Ha: diff != 0")
putexcel H1=("Ha: diff != 0")

local row=2
ttest edu  if io==1, by(exar1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=3
ttest edu  if io==1, by(exbr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=4
ttest edu  if io==1, by(excr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=5
ttest edu  if io==1, by(exdr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=6
ttest edu  if io==1, by(exer1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=7
ttest edu  if io==1, by(exfr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=8
ttest edu  if io==1, by(exgr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=9
ttest edu  if io==1, by(exhr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=10
ttest edu  if io==1, by(exir1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=11
ttest edu  if io==1, by(exjr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=12
ttest edu  if io==1, by(exkr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=13
ttest edu  if io==1, by(exlr1)
putexcel A`row' = (r(p))  , nformat(number_d2)


local row=2
ttest age  if io==1, by(exar1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=3
ttest age  if io==1, by(exbr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=4
ttest age  if io==1, by(excr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=5
ttest age  if io==1, by(exdr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=6
ttest age  if io==1, by(exer1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=7
ttest age  if io==1, by(exfr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=8
ttest age  if io==1, by(exgr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=9
ttest age  if io==1, by(exhr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=10
ttest age  if io==1, by(exir1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=11
ttest age  if io==1, by(exjr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=12
ttest age  if io==1, by(exkr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=13
ttest age  if io==1, by(exlr1)
putexcel B`row' = (r(p))  , nformat(number_d2)


local row=2
ttest gender  if io==1, by(exar1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=3
ttest gender  if io==1, by(exbr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=4
ttest gender  if io==1, by(excr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=5
ttest gender  if io==1, by(exdr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=6
ttest gender  if io==1, by(exer1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=7
ttest gender  if io==1, by(exfr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=8
ttest gender  if io==1, by(exgr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=9
ttest gender  if io==1, by(exhr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=10
ttest gender  if io==1, by(exir1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=11
ttest gender  if io==1, by(exjr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=12
ttest gender  if io==1, by(exkr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=13
ttest gender  if io==1, by(exlr1)
putexcel C`row' = (r(p))  , nformat(number_d2)


local row=2
ttest lr  if io==1, by(exar1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=3
ttest lr  if io==1, by(exbr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=4
ttest lr  if io==1, by(excr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=5
ttest lr  if io==1, by(exdr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=6
ttest lr  if io==1, by(exer1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=7
ttest lr  if io==1, by(exfr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=8
ttest lr  if io==1, by(exgr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=9
ttest lr  if io==1, by(exhr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=10
ttest lr  if io==1, by(exir1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=11
ttest lr  if io==1, by(exjr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=12
ttest lr  if io==1, by(exkr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=13
ttest lr  if io==1, by(exlr1)
putexcel D`row' = (r(p))  , nformat(number_d2)


local row=2
ttest trust  if io==1, by(exar1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=3
ttest trust  if io==1, by(exbr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=4
ttest trust  if io==1, by(excr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=5
ttest trust  if io==1, by(exdr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=6
ttest trust  if io==1, by(exer1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=7
ttest trust  if io==1, by(exfr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=8
ttest trust  if io==1, by(exgr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=9
ttest trust  if io==1, by(exhr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=10
ttest trust  if io==1, by(exir1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=11
ttest trust  if io==1, by(exjr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=12
ttest trust  if io==1, by(exkr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=13
ttest trust  if io==1, by(exlr1)
putexcel E`row' = (r(p))  , nformat(number_d2)


local row=2
ttest cosmo  if io==1, by(exar1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=3
ttest cosmo  if io==1, by(exbr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=4
ttest cosmo  if io==1, by(excr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=5
ttest cosmo  if io==1, by(exdr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=6
ttest cosmo  if io==1, by(exer1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=7
ttest cosmo  if io==1, by(exfr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=8
ttest cosmo  if io==1, by(exgr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=9
ttest cosmo  if io==1, by(exhr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=10
ttest cosmo  if io==1, by(exir1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=11
ttest cosmo  if io==1, by(exjr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=12
ttest cosmo  if io==1, by(exkr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=13
ttest cosmo  if io==1, by(exlr1)
putexcel F`row' = (r(p))  , nformat(number_d2)


local row=2
ttest govc  if io==1, by(exar1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=3
ttest govc  if io==1, by(exbr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=4
ttest govc  if io==1, by(excr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=5
ttest govc  if io==1, by(exdr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=6
ttest govc  if io==1, by(exer1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=7
ttest govc  if io==1, by(exfr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=8
ttest govc  if io==1, by(exgr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=9
ttest govc  if io==1, by(exhr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=10
ttest govc  if io==1, by(exir1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=11
ttest govc  if io==1, by(exjr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=12
ttest govc  if io==1, by(exkr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=13
ttest govc  if io==1, by(exlr1)
putexcel G`row' = (r(p))  , nformat(number_d2)


local row=2
ttest discuss  if io==1, by(exar1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=3
ttest discuss  if io==1, by(exbr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=4
ttest discuss  if io==1, by(excr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=5
ttest discuss  if io==1, by(exdr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=6
ttest discuss  if io==1, by(exer1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=7
ttest discuss  if io==1, by(exfr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=8
ttest discuss  if io==1, by(exgr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=9
ttest discuss  if io==1, by(exhr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=10
ttest discuss  if io==1, by(exir1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=11
ttest discuss  if io==1, by(exjr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=12
ttest discuss  if io==1, by(exkr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=13
ttest discuss  if io==1, by(exlr1)
putexcel H`row' = (r(p))  , nformat(number_d2)




******By round: ROs, round 2

tab io


putexcel set "T-test_reg1.xlsx", sheet("t_test") replace
putexcel A1=("Ha: diff != 0")
putexcel B1=("Ha: diff != 0")
putexcel C1=("Ha: diff != 0")
putexcel D1=("Ha: diff != 0")
putexcel E1=("Ha: diff != 0")
putexcel F1=("Ha: diff != 0")
putexcel G1=("Ha: diff != 0")
putexcel H1=("Ha: diff != 0")

local row=2
ttest edu if io==2|io==3, by(t_in_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=3
ttest edu if io==2|io==3, by(t_in_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=4
ttest edu if io==2|io==3, by(t_out_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=5
ttest edu if io==2|io==3, by(t_out_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=7
ttest edu if io==2|io==3, by(t_cso_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=8
ttest edu if io==2|io==3, by(t_cso_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=9
ttest edu if io==2|io==3, by(t_io_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=10
ttest edu if io==2|io==3, by(t_io_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=11
ttest edu if io==2|io==3, by(t_gov_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=12
ttest edu if io==2|io==3, by(t_gov_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=14
ttest edu if io==2|io==3, by(t_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=15
ttest edu if io==2|io==3, by(t_n)
putexcel A`row' = (r(p))  , nformat(number_d2)



local row=2
ttest age if io==2|io==3, by(t_in_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=3
ttest age if io==2|io==3, by(t_in_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=4
ttest age if io==2|io==3, by(t_out_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=5
ttest age if io==2|io==3, by(t_out_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=7
ttest age if io==2|io==3, by(t_cso_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=8
ttest age if io==2|io==3, by(t_cso_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=9
ttest age if io==2|io==3, by(t_io_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=10
ttest age if io==2|io==3, by(t_io_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=11
ttest age if io==2|io==3, by(t_gov_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=12
ttest age if io==2|io==3, by(t_gov_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=14
ttest age if io==2|io==3, by(t_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=15
ttest age if io==2|io==3, by(t_n)
putexcel B`row' = (r(p))  , nformat(number_d2)



local row=2
ttest gender if io==2|io==3, by(t_in_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=3
ttest gender if io==2|io==3, by(t_in_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=4
ttest gender if io==2|io==3, by(t_out_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=5
ttest gender if io==2|io==3, by(t_out_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=7
ttest gender if io==2|io==3, by(t_cso_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=8
ttest gender if io==2|io==3, by(t_cso_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=9
ttest gender if io==2|io==3, by(t_io_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=10
ttest gender if io==2|io==3, by(t_io_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=11
ttest gender if io==2|io==3, by(t_gov_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=12
ttest gender if io==2|io==3, by(t_gov_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=14
ttest gender if io==2|io==3, by(t_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=15
ttest gender if io==2|io==3, by(t_n)
putexcel C`row' = (r(p))  , nformat(number_d2)



local row=2
ttest lr if io==2|io==3, by(t_in_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=3
ttest lr if io==2|io==3, by(t_in_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=4
ttest lr if io==2|io==3, by(t_out_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=5
ttest lr if io==2|io==3, by(t_out_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=7
ttest lr if io==2|io==3, by(t_cso_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=8
ttest lr if io==2|io==3, by(t_cso_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=9
ttest lr if io==2|io==3, by(t_io_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=10
ttest lr if io==2|io==3, by(t_io_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=11
ttest lr if io==2|io==3, by(t_gov_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=12
ttest lr if io==2|io==3, by(t_gov_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=14
ttest lr if io==2|io==3, by(t_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=15
ttest lr if io==2|io==3, by(t_n)
putexcel D`row' = (r(p))  , nformat(number_d2)



local row=2
ttest trust if io==2|io==3, by(t_in_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=3
ttest trust if io==2|io==3, by(t_in_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=4
ttest trust if io==2|io==3, by(t_out_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=5
ttest trust if io==2|io==3, by(t_out_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=7
ttest trust if io==2|io==3, by(t_cso_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=8
ttest trust if io==2|io==3, by(t_cso_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=9
ttest trust if io==2|io==3, by(t_io_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=10
ttest trust if io==2|io==3, by(t_io_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=11
ttest trust if io==2|io==3, by(t_gov_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=12
ttest trust if io==2|io==3, by(t_gov_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=14
ttest trust if io==2|io==3, by(t_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=15
ttest trust if io==2|io==3, by(t_n)
putexcel E`row' = (r(p))  , nformat(number_d2)



local row=2
ttest cosmo if io==2|io==3, by(t_in_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=3
ttest cosmo if io==2|io==3, by(t_in_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=4
ttest cosmo if io==2|io==3, by(t_out_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=5
ttest cosmo if io==2|io==3, by(t_out_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=7
ttest cosmo if io==2|io==3, by(t_cso_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=8
ttest cosmo if io==2|io==3, by(t_cso_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=9
ttest cosmo if io==2|io==3, by(t_io_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=10
ttest cosmo if io==2|io==3, by(t_io_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=11
ttest cosmo if io==2|io==3, by(t_gov_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=12
ttest cosmo if io==2|io==3, by(t_gov_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=14
ttest cosmo if io==2|io==3, by(t_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=15
ttest cosmo if io==2|io==3, by(t_n)
putexcel F`row' = (r(p))  , nformat(number_d2)



local row=2
ttest govc if io==2|io==3, by(t_in_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=3
ttest govc if io==2|io==3, by(t_in_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=4
ttest govc if io==2|io==3, by(t_out_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=5
ttest govc if io==2|io==3, by(t_out_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=7
ttest govc if io==2|io==3, by(t_cso_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=8
ttest govc if io==2|io==3, by(t_cso_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=9
ttest govc if io==2|io==3, by(t_io_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=10
ttest govc if io==2|io==3, by(t_io_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=11
ttest govc if io==2|io==3, by(t_gov_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=12
ttest govc if io==2|io==3, by(t_gov_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=14
ttest govc if io==2|io==3, by(t_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=15
ttest govc if io==2|io==3, by(t_n)
putexcel G`row' = (r(p))  , nformat(number_d2)



local row=2
ttest discuss if io==2|io==3, by(t_in_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=3
ttest discuss if io==2|io==3, by(t_in_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=4
ttest discuss if io==2|io==3, by(t_out_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=5
ttest discuss if io==2|io==3, by(t_out_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=7
ttest discuss if io==2|io==3, by(t_cso_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=8
ttest discuss if io==2|io==3, by(t_cso_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=9
ttest discuss if io==2|io==3, by(t_io_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=10
ttest discuss if io==2|io==3, by(t_io_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=11
ttest discuss if io==2|io==3, by(t_gov_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=12
ttest discuss if io==2|io==3, by(t_gov_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=14
ttest discuss if io==2|io==3, by(t_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=15
ttest discuss if io==2|io==3, by(t_n)
putexcel H`row' = (r(p))  , nformat(number_d2)




***



putexcel set "T-test_reg2.xlsx", sheet("t_test") replace
putexcel A1=("Ha: diff != 0")
putexcel B1=("Ha: diff != 0")
putexcel C1=("Ha: diff != 0")
putexcel D1=("Ha: diff != 0")
putexcel E1=("Ha: diff != 0")
putexcel F1=("Ha: diff != 0")
putexcel G1=("Ha: diff != 0")
putexcel H1=("Ha: diff != 0")

local row=2
ttest edu  if io==2|io==3, by(exar1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=3
ttest edu  if io==2|io==3, by(exbr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=4
ttest edu  if io==2|io==3, by(excr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=5
ttest edu  if io==2|io==3, by(exdr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=6
ttest edu  if io==2|io==3, by(exer1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=7
ttest edu  if io==2|io==3, by(exfr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=8
ttest edu  if io==2|io==3, by(exgr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=9
ttest edu  if io==2|io==3, by(exhr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=10
ttest edu  if io==2|io==3, by(exir1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=11
ttest edu  if io==2|io==3, by(exjr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=12
ttest edu  if io==2|io==3, by(exkr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=13
ttest edu  if io==2|io==3, by(exlr1)
putexcel A`row' = (r(p))  , nformat(number_d2)


local row=2
ttest age  if io==2|io==3, by(exar1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=3
ttest age  if io==2|io==3, by(exbr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=4
ttest age  if io==2|io==3, by(excr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=5
ttest age  if io==2|io==3, by(exdr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=6
ttest age  if io==2|io==3, by(exer1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=7
ttest age  if io==2|io==3, by(exfr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=8
ttest age  if io==2|io==3, by(exgr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=9
ttest age  if io==2|io==3, by(exhr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=10
ttest age  if io==2|io==3, by(exir1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=11
ttest age  if io==2|io==3, by(exjr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=12
ttest age  if io==2|io==3, by(exkr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=13
ttest age  if io==2|io==3, by(exlr1)
putexcel B`row' = (r(p))  , nformat(number_d2)


local row=2
ttest gender  if io==2|io==3, by(exar1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=3
ttest gender  if io==2|io==3, by(exbr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=4
ttest gender  if io==2|io==3, by(excr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=5
ttest gender  if io==2|io==3, by(exdr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=6
ttest gender  if io==2|io==3, by(exer1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=7
ttest gender  if io==2|io==3, by(exfr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=8
ttest gender  if io==2|io==3, by(exgr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=9
ttest gender  if io==2|io==3, by(exhr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=10
ttest gender  if io==2|io==3, by(exir1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=11
ttest gender  if io==2|io==3, by(exjr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=12
ttest gender  if io==2|io==3, by(exkr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=13
ttest gender  if io==2|io==3, by(exlr1)
putexcel C`row' = (r(p))  , nformat(number_d2)


local row=2
ttest lr  if io==2|io==3, by(exar1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=3
ttest lr  if io==2|io==3, by(exbr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=4
ttest lr  if io==2|io==3, by(excr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=5
ttest lr  if io==2|io==3, by(exdr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=6
ttest lr  if io==2|io==3, by(exer1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=7
ttest lr  if io==2|io==3, by(exfr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=8
ttest lr  if io==2|io==3, by(exgr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=9
ttest lr  if io==2|io==3, by(exhr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=10
ttest lr  if io==2|io==3, by(exir1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=11
ttest lr  if io==2|io==3, by(exjr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=12
ttest lr  if io==2|io==3, by(exkr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=13
ttest lr  if io==2|io==3, by(exlr1)
putexcel D`row' = (r(p))  , nformat(number_d2)


local row=2
ttest trust  if io==2|io==3, by(exar1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=3
ttest trust  if io==2|io==3, by(exbr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=4
ttest trust  if io==2|io==3, by(excr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=5
ttest trust  if io==2|io==3, by(exdr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=6
ttest trust  if io==2|io==3, by(exer1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=7
ttest trust  if io==2|io==3, by(exfr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=8
ttest trust  if io==2|io==3, by(exgr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=9
ttest trust  if io==2|io==3, by(exhr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=10
ttest trust  if io==2|io==3, by(exir1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=11
ttest trust  if io==2|io==3, by(exjr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=12
ttest trust  if io==2|io==3, by(exkr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=13
ttest trust  if io==2|io==3, by(exlr1)
putexcel E`row' = (r(p))  , nformat(number_d2)


local row=2
ttest cosmo  if io==2|io==3, by(exar1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=3
ttest cosmo  if io==2|io==3, by(exbr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=4
ttest cosmo  if io==2|io==3, by(excr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=5
ttest cosmo  if io==2|io==3, by(exdr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=6
ttest cosmo  if io==2|io==3, by(exer1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=7
ttest cosmo  if io==2|io==3, by(exfr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=8
ttest cosmo  if io==2|io==3, by(exgr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=9
ttest cosmo  if io==2|io==3, by(exhr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=10
ttest cosmo  if io==2|io==3, by(exir1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=11
ttest cosmo  if io==2|io==3, by(exjr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=12
ttest cosmo  if io==2|io==3, by(exkr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=13
ttest cosmo  if io==2|io==3, by(exlr1)
putexcel F`row' = (r(p))  , nformat(number_d2)


local row=2
ttest govc  if io==2|io==3, by(exar1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=3
ttest govc  if io==2|io==3, by(exbr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=4
ttest govc  if io==2|io==3, by(excr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=5
ttest govc  if io==2|io==3, by(exdr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=6
ttest govc  if io==2|io==3, by(exer1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=7
ttest govc  if io==2|io==3, by(exfr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=8
ttest govc  if io==2|io==3, by(exgr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=9
ttest govc  if io==2|io==3, by(exhr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=10
ttest govc  if io==2|io==3, by(exir1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=11
ttest govc  if io==2|io==3, by(exjr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=12
ttest govc  if io==2|io==3, by(exkr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=13
ttest govc  if io==2|io==3, by(exlr1)
putexcel G`row' = (r(p))  , nformat(number_d2)


local row=2
ttest discuss  if io==2|io==3, by(exar1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=3
ttest discuss  if io==2|io==3, by(exbr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=4
ttest discuss  if io==2|io==3, by(excr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=5
ttest discuss  if io==2|io==3, by(exdr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=6
ttest discuss  if io==2|io==3, by(exer1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=7
ttest discuss  if io==2|io==3, by(exfr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=8
ttest discuss  if io==2|io==3, by(exgr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=9
ttest discuss  if io==2|io==3, by(exhr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=10
ttest discuss  if io==2|io==3, by(exir1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=11
ttest discuss  if io==2|io==3, by(exjr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=12
ttest discuss  if io==2|io==3, by(exkr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=13
ttest discuss  if io==2|io==3, by(exlr1)
putexcel H`row' = (r(p))  , nformat(number_d2)




******By round: IMF, round 3

tab io


putexcel set "T-test_IMF1.xlsx", sheet("t_test") replace
putexcel A1=("Ha: diff != 0")
putexcel B1=("Ha: diff != 0")
putexcel C1=("Ha: diff != 0")
putexcel D1=("Ha: diff != 0")
putexcel E1=("Ha: diff != 0")
putexcel F1=("Ha: diff != 0")
putexcel G1=("Ha: diff != 0")
putexcel H1=("Ha: diff != 0")

local row=2
ttest edu if io==4, by(t_in_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=3
ttest edu if io==4, by(t_in_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=4
ttest edu if io==4, by(t_out_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=5
ttest edu if io==4, by(t_out_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=7
ttest edu if io==4, by(t_cso_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=8
ttest edu if io==4, by(t_cso_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=9
ttest edu if io==4, by(t_io_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=10
ttest edu if io==4, by(t_io_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=11
ttest edu if io==4, by(t_gov_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=12
ttest edu if io==4, by(t_gov_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=14
ttest edu if io==4, by(t_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=15
ttest edu if io==4, by(t_n)
putexcel A`row' = (r(p))  , nformat(number_d2)



local row=2
ttest age if io==4, by(t_in_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=3
ttest age if io==4, by(t_in_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=4
ttest age if io==4, by(t_out_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=5
ttest age if io==4, by(t_out_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=7
ttest age if io==4, by(t_cso_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=8
ttest age if io==4, by(t_cso_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=9
ttest age if io==4, by(t_io_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=10
ttest age if io==4, by(t_io_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=11
ttest age if io==4, by(t_gov_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=12
ttest age if io==4, by(t_gov_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=14
ttest age if io==4, by(t_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=15
ttest age if io==4, by(t_n)
putexcel B`row' = (r(p))  , nformat(number_d2)



local row=2
ttest gender if io==4, by(t_in_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=3
ttest gender if io==4, by(t_in_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=4
ttest gender if io==4, by(t_out_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=5
ttest gender if io==4, by(t_out_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=7
ttest gender if io==4, by(t_cso_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=8
ttest gender if io==4, by(t_cso_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=9
ttest gender if io==4, by(t_io_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=10
ttest gender if io==4, by(t_io_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=11
ttest gender if io==4, by(t_gov_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=12
ttest gender if io==4, by(t_gov_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=14
ttest gender if io==4, by(t_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=15
ttest gender if io==4, by(t_n)
putexcel C`row' = (r(p))  , nformat(number_d2)



local row=2
ttest lr if io==4, by(t_in_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=3
ttest lr if io==4, by(t_in_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=4
ttest lr if io==4, by(t_out_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=5
ttest lr if io==4, by(t_out_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=7
ttest lr if io==4, by(t_cso_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=8
ttest lr if io==4, by(t_cso_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=9
ttest lr if io==4, by(t_io_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=10
ttest lr if io==4, by(t_io_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=11
ttest lr if io==4, by(t_gov_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=12
ttest lr if io==4, by(t_gov_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=14
ttest lr if io==4, by(t_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=15
ttest lr if io==4, by(t_n)
putexcel D`row' = (r(p))  , nformat(number_d2)



local row=2
ttest trust if io==4, by(t_in_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=3
ttest trust if io==4, by(t_in_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=4
ttest trust if io==4, by(t_out_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=5
ttest trust if io==4, by(t_out_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=7
ttest trust if io==4, by(t_cso_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=8
ttest trust if io==4, by(t_cso_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=9
ttest trust if io==4, by(t_io_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=10
ttest trust if io==4, by(t_io_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=11
ttest trust if io==4, by(t_gov_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=12
ttest trust if io==4, by(t_gov_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=14
ttest trust if io==4, by(t_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=15
ttest trust if io==4, by(t_n)
putexcel E`row' = (r(p))  , nformat(number_d2)



local row=2
ttest cosmo if io==4, by(t_in_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=3
ttest cosmo if io==4, by(t_in_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=4
ttest cosmo if io==4, by(t_out_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=5
ttest cosmo if io==4, by(t_out_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=7
ttest cosmo if io==4, by(t_cso_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=8
ttest cosmo if io==4, by(t_cso_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=9
ttest cosmo if io==4, by(t_io_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=10
ttest cosmo if io==4, by(t_io_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=11
ttest cosmo if io==4, by(t_gov_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=12
ttest cosmo if io==4, by(t_gov_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=14
ttest cosmo if io==4, by(t_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=15
ttest cosmo if io==4, by(t_n)
putexcel F`row' = (r(p))  , nformat(number_d2)



local row=2
ttest govc if io==4, by(t_in_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=3
ttest govc if io==4, by(t_in_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=4
ttest govc if io==4, by(t_out_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=5
ttest govc if io==4, by(t_out_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=7
ttest govc if io==4, by(t_cso_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=8
ttest govc if io==4, by(t_cso_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=9
ttest govc if io==4, by(t_io_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=10
ttest govc if io==4, by(t_io_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=11
ttest govc if io==4, by(t_gov_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=12
ttest govc if io==4, by(t_gov_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=14
ttest govc if io==4, by(t_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=15
ttest govc if io==4, by(t_n)
putexcel G`row' = (r(p))  , nformat(number_d2)



local row=2
ttest discuss if io==4, by(t_in_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=3
ttest discuss if io==4, by(t_in_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=4
ttest discuss if io==4, by(t_out_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=5
ttest discuss if io==4, by(t_out_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=7
ttest discuss if io==4, by(t_cso_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=8
ttest discuss if io==4, by(t_cso_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=9
ttest discuss if io==4, by(t_io_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=10
ttest discuss if io==4, by(t_io_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=11
ttest discuss if io==4, by(t_gov_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=12
ttest discuss if io==4, by(t_gov_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=14
ttest discuss if io==4, by(t_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=15
ttest discuss if io==4, by(t_n)
putexcel H`row' = (r(p))  , nformat(number_d2)




***



putexcel set "T-test_IMF2.xlsx", sheet("t_test") replace
putexcel A1=("Ha: diff != 0")
putexcel B1=("Ha: diff != 0")
putexcel C1=("Ha: diff != 0")
putexcel D1=("Ha: diff != 0")
putexcel E1=("Ha: diff != 0")
putexcel F1=("Ha: diff != 0")
putexcel G1=("Ha: diff != 0")
putexcel H1=("Ha: diff != 0")

local row=2
ttest edu  if io==4, by(exar1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=3
ttest edu  if io==4, by(exbr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=4
ttest edu  if io==4, by(excr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=5
ttest edu  if io==4, by(exdr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=6
ttest edu  if io==4, by(exer1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=7
ttest edu  if io==4, by(exfr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=8
ttest edu  if io==4, by(exgr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=9
ttest edu  if io==4, by(exhr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=10
ttest edu  if io==4, by(exir1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=11
ttest edu  if io==4, by(exjr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=12
ttest edu  if io==4, by(exkr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=13
ttest edu  if io==4, by(exlr1)
putexcel A`row' = (r(p))  , nformat(number_d2)


local row=2
ttest age  if io==4, by(exar1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=3
ttest age  if io==4, by(exbr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=4
ttest age  if io==4, by(excr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=5
ttest age  if io==4, by(exdr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=6
ttest age  if io==4, by(exer1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=7
ttest age  if io==4, by(exfr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=8
ttest age  if io==4, by(exgr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=9
ttest age  if io==4, by(exhr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=10
ttest age  if io==4, by(exir1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=11
ttest age  if io==4, by(exjr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=12
ttest age  if io==4, by(exkr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=13
ttest age  if io==4, by(exlr1)
putexcel B`row' = (r(p))  , nformat(number_d2)


local row=2
ttest gender  if io==4, by(exar1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=3
ttest gender  if io==4, by(exbr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=4
ttest gender  if io==4, by(excr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=5
ttest gender  if io==4, by(exdr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=6
ttest gender  if io==4, by(exer1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=7
ttest gender  if io==4, by(exfr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=8
ttest gender  if io==4, by(exgr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=9
ttest gender  if io==4, by(exhr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=10
ttest gender  if io==4, by(exir1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=11
ttest gender  if io==4, by(exjr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=12
ttest gender  if io==4, by(exkr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=13
ttest gender  if io==4, by(exlr1)
putexcel C`row' = (r(p))  , nformat(number_d2)


local row=2
ttest lr  if io==4, by(exar1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=3
ttest lr  if io==4, by(exbr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=4
ttest lr  if io==4, by(excr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=5
ttest lr  if io==4, by(exdr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=6
ttest lr  if io==4, by(exer1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=7
ttest lr  if io==4, by(exfr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=8
ttest lr  if io==4, by(exgr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=9
ttest lr  if io==4, by(exhr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=10
ttest lr  if io==4, by(exir1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=11
ttest lr  if io==4, by(exjr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=12
ttest lr  if io==4, by(exkr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=13
ttest lr  if io==4, by(exlr1)
putexcel D`row' = (r(p))  , nformat(number_d2)


local row=2
ttest trust  if io==4, by(exar1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=3
ttest trust  if io==4, by(exbr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=4
ttest trust  if io==4, by(excr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=5
ttest trust  if io==4, by(exdr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=6
ttest trust  if io==4, by(exer1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=7
ttest trust  if io==4, by(exfr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=8
ttest trust  if io==4, by(exgr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=9
ttest trust  if io==4, by(exhr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=10
ttest trust  if io==4, by(exir1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=11
ttest trust  if io==4, by(exjr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=12
ttest trust  if io==4, by(exkr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=13
ttest trust  if io==4, by(exlr1)
putexcel E`row' = (r(p))  , nformat(number_d2)


local row=2
ttest cosmo  if io==4, by(exar1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=3
ttest cosmo  if io==4, by(exbr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=4
ttest cosmo  if io==4, by(excr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=5
ttest cosmo  if io==4, by(exdr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=6
ttest cosmo  if io==4, by(exer1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=7
ttest cosmo  if io==4, by(exfr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=8
ttest cosmo  if io==4, by(exgr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=9
ttest cosmo  if io==4, by(exhr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=10
ttest cosmo  if io==4, by(exir1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=11
ttest cosmo  if io==4, by(exjr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=12
ttest cosmo  if io==4, by(exkr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=13
ttest cosmo  if io==4, by(exlr1)
putexcel F`row' = (r(p))  , nformat(number_d2)


local row=2
ttest govc  if io==4, by(exar1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=3
ttest govc  if io==4, by(exbr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=4
ttest govc  if io==4, by(excr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=5
ttest govc  if io==4, by(exdr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=6
ttest govc  if io==4, by(exer1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=7
ttest govc  if io==4, by(exfr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=8
ttest govc  if io==4, by(exgr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=9
ttest govc  if io==4, by(exhr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=10
ttest govc  if io==4, by(exir1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=11
ttest govc  if io==4, by(exjr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=12
ttest govc  if io==4, by(exkr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=13
ttest govc  if io==4, by(exlr1)
putexcel G`row' = (r(p))  , nformat(number_d2)


local row=2
ttest discuss  if io==4, by(exar1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=3
ttest discuss  if io==4, by(exbr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=4
ttest discuss  if io==4, by(excr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=5
ttest discuss  if io==4, by(exdr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=6
ttest discuss  if io==4, by(exer1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=7
ttest discuss  if io==4, by(exfr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=8
ttest discuss  if io==4, by(exgr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=9
ttest discuss  if io==4, by(exhr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=10
ttest discuss  if io==4, by(exir1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=11
ttest discuss  if io==4, by(exjr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=12
ttest discuss  if io==4, by(exkr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=13
ttest discuss  if io==4, by(exlr1)
putexcel H`row' = (r(p))  , nformat(number_d2)





******By round: WTO, round 5

tab io


putexcel set "T-test_WTO1.xlsx", sheet("t_test") replace
putexcel A1=("Ha: diff != 0")
putexcel B1=("Ha: diff != 0")
putexcel C1=("Ha: diff != 0")
putexcel D1=("Ha: diff != 0")
putexcel E1=("Ha: diff != 0")
putexcel F1=("Ha: diff != 0")
putexcel G1=("Ha: diff != 0")
putexcel H1=("Ha: diff != 0")

local row=2
ttest edu if io==4, by(t_in_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=3
ttest edu if io==5, by(t_in_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=4
ttest edu if io==5, by(t_out_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=5
ttest edu if io==5, by(t_out_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=7
ttest edu if io==5, by(t_cso_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=8
ttest edu if io==5, by(t_cso_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=9
ttest edu if io==5, by(t_io_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=10
ttest edu if io==5, by(t_io_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=11
ttest edu if io==5, by(t_gov_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=12
ttest edu if io==5, by(t_gov_n)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=14
ttest edu if io==5, by(t_p)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=15
ttest edu if io==5, by(t_n)
putexcel A`row' = (r(p))  , nformat(number_d2)



local row=2
ttest age if io==5, by(t_in_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=3
ttest age if io==5, by(t_in_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=4
ttest age if io==5, by(t_out_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=5
ttest age if io==5, by(t_out_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=7
ttest age if io==5, by(t_cso_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=8
ttest age if io==5, by(t_cso_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=9
ttest age if io==5, by(t_io_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=10
ttest age if io==5, by(t_io_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=11
ttest age if io==5, by(t_gov_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=12
ttest age if io==5, by(t_gov_n)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=14
ttest age if io==5, by(t_p)
putexcel B`row' = (r(p))  , nformat(number_d2)

local row=15
ttest age if io==5, by(t_n)
putexcel B`row' = (r(p))  , nformat(number_d2)



local row=2
ttest gender if io==5, by(t_in_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=3
ttest gender if io==5, by(t_in_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=4
ttest gender if io==5, by(t_out_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=5
ttest gender if io==5, by(t_out_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=7
ttest gender if io==5, by(t_cso_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=8
ttest gender if io==5, by(t_cso_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=9
ttest gender if io==5, by(t_io_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=10
ttest gender if io==5, by(t_io_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=11
ttest gender if io==5, by(t_gov_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=12
ttest gender if io==5, by(t_gov_n)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=14
ttest gender if io==5, by(t_p)
putexcel C`row' = (r(p))  , nformat(number_d2)

local row=15
ttest gender if io==5, by(t_n)
putexcel C`row' = (r(p))  , nformat(number_d2)



local row=2
ttest lr if io==5, by(t_in_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=3
ttest lr if io==5, by(t_in_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=4
ttest lr if io==5, by(t_out_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=5
ttest lr if io==5, by(t_out_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=7
ttest lr if io==5, by(t_cso_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=8
ttest lr if io==5, by(t_cso_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=9
ttest lr if io==5, by(t_io_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=10
ttest lr if io==5, by(t_io_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=11
ttest lr if io==5, by(t_gov_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=12
ttest lr if io==5, by(t_gov_n)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=14
ttest lr if io==5, by(t_p)
putexcel D`row' = (r(p))  , nformat(number_d2)

local row=15
ttest lr if io==5, by(t_n)
putexcel D`row' = (r(p))  , nformat(number_d2)



local row=2
ttest trust if io==5, by(t_in_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=3
ttest trust if io==5, by(t_in_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=4
ttest trust if io==5, by(t_out_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=5
ttest trust if io==5, by(t_out_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=7
ttest trust if io==5, by(t_cso_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=8
ttest trust if io==5, by(t_cso_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=9
ttest trust if io==5, by(t_io_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=10
ttest trust if io==5, by(t_io_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=11
ttest trust if io==5, by(t_gov_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=12
ttest trust if io==5, by(t_gov_n)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=14
ttest trust if io==5, by(t_p)
putexcel E`row' = (r(p))  , nformat(number_d2)

local row=15
ttest trust if io==5, by(t_n)
putexcel E`row' = (r(p))  , nformat(number_d2)



local row=2
ttest cosmo if io==5, by(t_in_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=3
ttest cosmo if io==5, by(t_in_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=4
ttest cosmo if io==5, by(t_out_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=5
ttest cosmo if io==5, by(t_out_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=7
ttest cosmo if io==5, by(t_cso_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=8
ttest cosmo if io==5, by(t_cso_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=9
ttest cosmo if io==5, by(t_io_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=10
ttest cosmo if io==5, by(t_io_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=11
ttest cosmo if io==5, by(t_gov_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=12
ttest cosmo if io==5, by(t_gov_n)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=14
ttest cosmo if io==5, by(t_p)
putexcel F`row' = (r(p))  , nformat(number_d2)

local row=15
ttest cosmo if io==5, by(t_n)
putexcel F`row' = (r(p))  , nformat(number_d2)



local row=2
ttest govc if io==5, by(t_in_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=3
ttest govc if io==5, by(t_in_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=4
ttest govc if io==5, by(t_out_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=5
ttest govc if io==5, by(t_out_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=7
ttest govc if io==5, by(t_cso_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=8
ttest govc if io==5, by(t_cso_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=9
ttest govc if io==5, by(t_io_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=10
ttest govc if io==5, by(t_io_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=11
ttest govc if io==5, by(t_gov_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=12
ttest govc if io==5, by(t_gov_n)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=14
ttest govc if io==5, by(t_p)
putexcel G`row' = (r(p))  , nformat(number_d2)

local row=15
ttest govc if io==5, by(t_n)
putexcel G`row' = (r(p))  , nformat(number_d2)



local row=2
ttest discuss if io==5, by(t_in_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=3
ttest discuss if io==5, by(t_in_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=4
ttest discuss if io==5, by(t_out_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=5
ttest discuss if io==5, by(t_out_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=7
ttest discuss if io==5, by(t_cso_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=8
ttest discuss if io==5, by(t_cso_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=9
ttest discuss if io==5, by(t_io_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=10
ttest discuss if io==5, by(t_io_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=11
ttest discuss if io==5, by(t_gov_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=12
ttest discuss if io==5, by(t_gov_n)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=14
ttest discuss if io==5, by(t_p)
putexcel H`row' = (r(p))  , nformat(number_d2)

local row=15
ttest discuss if io==5, by(t_n)
putexcel H`row' = (r(p))  , nformat(number_d2)




***



putexcel set "T-test_WTO2.xlsx", sheet("t_test") replace
putexcel A1=("Ha: diff != 0")
putexcel B1=("Ha: diff != 0")
putexcel C1=("Ha: diff != 0")
putexcel D1=("Ha: diff != 0")
putexcel E1=("Ha: diff != 0")
putexcel F1=("Ha: diff != 0")
putexcel G1=("Ha: diff != 0")
putexcel H1=("Ha: diff != 0")

local row=2
ttest edu  if io==5, by(exar1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=3
ttest edu  if io==5, by(exbr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=4
ttest edu  if io==5, by(excr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=5
ttest edu  if io==5, by(exdr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=6
ttest edu  if io==5, by(exer1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=7
ttest edu  if io==5, by(exfr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=8
ttest edu  if io==5, by(exgr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=9
ttest edu  if io==5, by(exhr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=10
ttest edu  if io==5, by(exir1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=11
ttest edu  if io==5, by(exjr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=12
ttest edu  if io==5, by(exkr1)
putexcel A`row' = (r(p))  , nformat(number_d2)
local row=13
ttest edu  if io==5, by(exlr1)
putexcel A`row' = (r(p))  , nformat(number_d2)

local row=2
ttest age  if io==5, by(exar1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=3
ttest age  if io==5, by(exbr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=4
ttest age  if io==5, by(excr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=5
ttest age  if io==5, by(exdr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=6
ttest age  if io==5, by(exer1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=7
ttest age  if io==5, by(exfr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=8
ttest age  if io==5, by(exgr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=9
ttest age  if io==5, by(exhr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=10
ttest age  if io==5, by(exir1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=11
ttest age  if io==5, by(exjr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=12
ttest age  if io==5, by(exkr1)
putexcel B`row' = (r(p))  , nformat(number_d2)
local row=13
ttest age  if io==5, by(exlr1)
putexcel B`row' = (r(p))  , nformat(number_d2)


local row=2
ttest gender  if io==5, by(exar1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=3
ttest gender  if io==5, by(exbr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=4
ttest gender  if io==5, by(excr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=5
ttest gender  if io==5, by(exdr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=6
ttest gender  if io==5, by(exer1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=7
ttest gender  if io==5, by(exfr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=8
ttest gender  if io==5, by(exgr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=9
ttest gender  if io==5, by(exhr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=10
ttest gender  if io==5, by(exir1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=11
ttest gender  if io==5, by(exjr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=12
ttest gender  if io==5, by(exkr1)
putexcel C`row' = (r(p))  , nformat(number_d2)
local row=13
ttest gender  if io==5, by(exlr1)
putexcel C`row' = (r(p))  , nformat(number_d2)


local row=2
ttest lr  if io==5, by(exar1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=3
ttest lr  if io==5, by(exbr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=4
ttest lr  if io==5, by(excr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=5
ttest lr  if io==5, by(exdr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=6
ttest lr  if io==5, by(exer1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=7
ttest lr  if io==5, by(exfr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=8
ttest lr  if io==5, by(exgr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=9
ttest lr  if io==5, by(exhr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=10
ttest lr  if io==5, by(exir1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=11
ttest lr  if io==5, by(exjr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=12
ttest lr  if io==5, by(exkr1)
putexcel D`row' = (r(p))  , nformat(number_d2)
local row=13
ttest lr  if io==5, by(exlr1)
putexcel D`row' = (r(p))  , nformat(number_d2)


local row=2
ttest trust  if io==5, by(exar1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=3
ttest trust  if io==5, by(exbr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=4
ttest trust  if io==5, by(excr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=5
ttest trust  if io==5, by(exdr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=6
ttest trust  if io==5, by(exer1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=7
ttest trust  if io==5, by(exfr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=8
ttest trust  if io==5, by(exgr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=9
ttest trust  if io==5, by(exhr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=10
ttest trust  if io==5, by(exir1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=11
ttest trust  if io==5, by(exjr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=12
ttest trust  if io==5, by(exkr1)
putexcel E`row' = (r(p))  , nformat(number_d2)
local row=13
ttest trust  if io==5, by(exlr1)
putexcel E`row' = (r(p))  , nformat(number_d2)


local row=2
ttest cosmo  if io==5, by(exar1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=3
ttest cosmo  if io==5, by(exbr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=4
ttest cosmo  if io==5, by(excr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=5
ttest cosmo  if io==5, by(exdr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=6
ttest cosmo  if io==5, by(exer1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=7
ttest cosmo  if io==5, by(exfr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=8
ttest cosmo  if io==5, by(exgr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=9
ttest cosmo  if io==5, by(exhr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=10
ttest cosmo  if io==5, by(exir1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=11
ttest cosmo  if io==5, by(exjr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=12
ttest cosmo  if io==5, by(exkr1)
putexcel F`row' = (r(p))  , nformat(number_d2)
local row=13
ttest cosmo  if io==5, by(exlr1)
putexcel F`row' = (r(p))  , nformat(number_d2)


local row=2
ttest govc  if io==5, by(exar1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=3
ttest govc  if io==5, by(exbr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=4
ttest govc  if io==5, by(excr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=5
ttest govc  if io==5, by(exdr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=6
ttest govc  if io==5, by(exer1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=7
ttest govc  if io==5, by(exfr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=8
ttest govc  if io==5, by(exgr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=9
ttest govc  if io==5, by(exhr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=10
ttest govc  if io==5, by(exir1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=11
ttest govc  if io==5, by(exjr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=12
ttest govc  if io==5, by(exkr1)
putexcel G`row' = (r(p))  , nformat(number_d2)
local row=13
ttest govc  if io==5, by(exlr1)
putexcel G`row' = (r(p))  , nformat(number_d2)


local row=2
ttest discuss  if io==5, by(exar1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=3
ttest discuss  if io==5, by(exbr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=4
ttest discuss  if io==5, by(excr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=5
ttest discuss  if io==5, by(exdr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=6
ttest discuss  if io==5, by(exer1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=7
ttest discuss  if io==5, by(exfr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=8
ttest discuss  if io==5, by(exgr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=9
ttest discuss  if io==5, by(exhr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=10
ttest discuss  if io==5, by(exir1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=11
ttest discuss  if io==5, by(exjr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=12
ttest discuss  if io==5, by(exkr1)
putexcel H`row' = (r(p))  , nformat(number_d2)
local row=13
ttest discuss  if io==5, by(exlr1)
putexcel H`row' = (r(p))  , nformat(number_d2)

 
 
 
 
 
*     ****************************************************************  *;
*     Appendix H: Missingness   								        *;
*     ****************************************************************  *;
 
/*Here we examine the causal process behind outcome missingness, although this problem is 
unlikely to affect the results given the very low number of missing values. In fact,
we show that all results remain robust when replicating the analyses presented in Tables 
2-4 while relaxing the assumption that the randomization was successful 
*/
 

tab conf
gen missing=0
replace missing=1 if conf==.

tab missing if io==1 

tab missing if io5==2
tab missing if io5==3

tab missing if io==3
tab missing if io==4

set more off

*Table J1

logit missing edu age gender if io5==1, cluster(id)
eststo a
logit missing edu age gender if io5==2, cluster(id)
eststo b
logit missing edu age gender if io5==3, cluster(id)
eststo c
logit missing edu age gender if io5==4, cluster(id)
eststo d
logit missing edu age gender if io5==5, cluster(id)
eststo e
logit missing edu age gender, cluster(id)
eststo f

esttab a d e b c f using table_J1.rtf, bic scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars
 
 
*Rest of Appendix J



set more off

reg conf t_cso_p edu age gender    [aw=weight], cluster(id)
eststo csop

reg conf t_cso_n  edu age gender  [aw=weight], cluster(id)
eststo cson

reg conf t_io_p edu age gender   [aw=weight], cluster(id)
eststo iop

reg conf t_io_n  edu age gender  [aw=weight], cluster(id)
eststo ion

reg conf t_gov_p  edu age gender  [aw=weight], cluster(id)
eststo govp

reg conf t_gov_n  edu age gender  [aw=weight], cluster(id)
eststo govn

reg conf t_cso_io_p  edu age gender   [aw=weight], cluster(id)
eststo csoiop

reg conf t_cso_io_n  edu age gender  [aw=weight], cluster(id)
eststo csoion

reg conf t_gov_io_p  edu age gender  [aw=weight], cluster(id)
eststo goviop

reg conf t_gov_io_n edu age gender   [aw=weight], cluster(id)
eststo govion

reg conf t_cso_gov_p  edu age gender  [aw=weight], cluster(id)
eststo csogovp

reg conf t_cso_gov_n  edu age gender  [aw=weight], cluster(id)
eststo csogovn


esttab csop cson iop ion govp govn csoiop csoion goviop govion csogovp csogovn ///
 using tableJ2.rtf, bic scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars


set more off

reg conf t_in_p edu age gender [aw=weight], cluster(id)
eststo inp

reg conf t_in_n edu age gender  [aw=weight], cluster(id)
eststo inn

reg conf t_out_p edu age gender  [aw=weight], cluster(id)
eststo outp

reg conf t_out_n edu age gender  [aw=weight], cluster(id)
eststo outn

reg conf t_in_out_p edu age gender  [aw=weight], cluster(id)
eststo inoutp

reg conf t_in_out_n edu age gender  [aw=weight], cluster(id)
eststo inoutn

 
esttab inp inn outp outn inoutp inoutn ///
 using tableJ3.rtf, bic scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars



set more off

reg conf t_p edu age gender [aw=weight], cluster(id)
eststo pos

reg conf t_n edu age gender [aw=weight], cluster(id)
eststo neg

reg conf t_pn edu age gender [aw=weight], cluster(id)
eststo posneg

esttab pos neg posneg ///
 using tableJ4.rtf, bic scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars







***

reg conf t_cso_p edu age gender if io==1 [aw=weight], cluster(id)
eststo csop

reg conf t_cso_n edu age gender if io==1 [aw=weight], cluster(id)
eststo cson

reg conf t_io_p edu age gender if io==1 [aw=weight], cluster(id)
eststo iop

reg conf t_io_n edu age gender if io==1 [aw=weight], cluster(id)
eststo ion

reg conf t_gov_p edu age gender if io==1 [aw=weight], cluster(id)
eststo govp

reg conf t_gov_n edu age gender if io==1 [aw=weight], cluster(id)
eststo govn


reg conf t_in_p edu age gender if io==1 [aw=weight], cluster(id)
eststo inp

reg conf t_in_n edu age gender if io==1 [aw=weight], cluster(id)
eststo inn

reg conf t_out_p edu age gender if io==1 [aw=weight], cluster(id)
eststo outp

reg conf t_out_n edu age gender if io==1 [aw=weight], cluster(id)
eststo outn


***

reg conf t_p edu age gender if io==1 [aw=weight], cluster(id)
eststo pos

reg conf t_n edu age gender if io==1 [aw=weight], cluster(id)
eststo neg
 

esttab  csop cson iop ion govp govn inp inn outp outn pos neg  ///
using tableJ5.un.rtf, bic scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars






reg conf t_cso_p edu age gender if io==4 [aw=weight], cluster(id)
eststo csop

reg conf t_cso_n edu age gender if io==4 [aw=weight], cluster(id)
eststo cson

reg conf t_io_p edu age gender if io==4 [aw=weight], cluster(id)
eststo iop

reg conf t_io_n edu age gender if io==4 [aw=weight], cluster(id)
eststo ion

reg conf t_gov_p edu age gender if io==4 [aw=weight], cluster(id)
eststo govp

reg conf t_gov_n edu age gender if io==4 [aw=weight], cluster(id)
eststo govn


reg conf t_in_p edu age gender if io==4 [aw=weight], cluster(id)
eststo inp

reg conf t_in_n edu age gender if io==4 [aw=weight], cluster(id)
eststo inn

reg conf t_out_p edu age gender if io==4 [aw=weight], cluster(id)
eststo outp

reg conf t_out_n edu age gender if io==4 [aw=weight], cluster(id)
eststo outn


***

reg conf t_p edu age gender if io==4 [aw=weight], cluster(id)
eststo pos

reg conf t_n edu age gender if io==4 [aw=weight], cluster(id)
eststo neg
 

esttab  csop cson iop ion govp govn inp inn outp outn pos neg  ///
using tableJ6.imf.rtf, bic scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars



set more off

reg conf t_in_p edu age gender if io==5 [aw=weight], cluster(id)
eststo inp

reg conf t_in_n edu age gender if io==5 [aw=weight], cluster(id)
eststo inn

reg conf t_out_p edu age gender if io==5 [aw=weight], cluster(id)
eststo outp

reg conf t_out_n edu age gender if io==5 [aw=weight], cluster(id)
eststo outn




***

reg conf t_cso_p edu age gender if io==5 [aw=weight], cluster(id)
eststo csop

reg conf t_cso_n edu age gender if io==5 [aw=weight], cluster(id)
eststo cson

reg conf t_io_p edu age gender if io==5 [aw=weight], cluster(id)
eststo iop

reg conf t_io_n edu age gender if io==5 [aw=weight], cluster(id)
eststo ion

reg conf t_gov_p edu age gender if io==5 [aw=weight], cluster(id)
eststo govp

reg conf t_gov_n edu age gender if io==5 [aw=weight], cluster(id)
eststo govn



***

reg conf t_p edu age gender if io==5 [aw=weight], cluster(id)
eststo pos

reg conf t_n edu age gender if io==5 [aw=weight], cluster(id)
eststo neg
 


esttab  csop cson iop ion govp govn inp inn outp outn pos neg  ///
using tableJ7.WTO.rtf, bic scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars





set more off

***

reg conf t_cso_p edu age gender if io==2 [aw=weight], cluster(id)
eststo csop

reg conf t_cso_n edu age gender if io==2 [aw=weight], cluster(id)
eststo cson

reg conf t_io_p edu age gender if io==2 [aw=weight], cluster(id)
eststo iop

reg conf t_io_n edu age gender if io==2 [aw=weight], cluster(id)
eststo ion

reg conf t_gov_p edu age gender if io==2 [aw=weight], cluster(id)
eststo govp

reg conf t_gov_n edu age gender if io==2 [aw=weight], cluster(id)
eststo govn

reg conf t_in_p edu age gender if io==2 [aw=weight], cluster(id)
eststo inp

reg conf t_in_n edu age gender if io==2 [aw=weight], cluster(id)
eststo inn

reg conf t_out_p edu age gender if io==2 [aw=weight], cluster(id)
eststo outp

reg conf t_out_n edu age gender if io==2 [aw=weight], cluster(id)
eststo outn



***

reg conf t_p edu age gender if io==2 [aw=weight], cluster(id)
eststo pos

reg conf t_n edu age gender if io==2 [aw=weight], cluster(id)
eststo neg



esttab  csop cson iop ion govp govn inp inn outp outn pos neg  ///
using tableJ8.eu.rtf, bic scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars





set more off

***

reg conf t_cso_p edu age gender if io==3 [aw=weight], cluster(id)
eststo csop

reg conf t_cso_n edu age gender if io==3 [aw=weight], cluster(id)
eststo cson

reg conf t_io_p edu age gender if io==3 [aw=weight], cluster(id)
eststo iop

reg conf t_io_n edu age gender if io==3 [aw=weight], cluster(id)
eststo ion

reg conf t_gov_p edu age gender if io==3 [aw=weight], cluster(id)
eststo govp

reg conf t_gov_n edu age gender if io==3 [aw=weight], cluster(id)
eststo govn


reg conf t_in_p edu age gender if io==3 [aw=weight], cluster(id)
eststo inp

reg conf t_in_n edu age gender if io==3 [aw=weight], cluster(id)
eststo inn

reg conf t_out_p edu age gender if io==3 [aw=weight], cluster(id)
eststo outp

reg conf t_out_n edu age gender if io==3 [aw=weight], cluster(id)
eststo outn


***

reg conf t_p edu age gender if io==3 [aw=weight], cluster(id)
eststo pos

reg conf t_n edu age gender if io==3 [aw=weight], cluster(id)
eststo neg
 

esttab  csop cson iop ion govp govn inp inn outp outn pos neg  ///
using tableJ9.NAFTA.rtf, bic scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars




*     ****************************************************************  *;
*     Appendix I: Results with interaction terms				        *;
*     ****************************************************************  *;
 
 
*1.	credibility for national government. z= partisan ID match with current national gov 
*Replicate Table D1
set more off

gen partyid=0
*DE: CDU/CSU/SPD
*UK: Tory/Liberal
*US: Democrats
tab partyID_neu, nol
replace partyid=1 if partyID_neu==1|partyID_neu==2
tab qpartyid, nol
replace partyid=1 if qpartyid==2|qpartyid==3
tab pid3, nol
replace partyid=1 if pid3==1
by country, sort: tab partyid

reg conf i.t_gov_p##i.partyid  [aw=weight],  cluster(id)
eststo govp

reg conf i.t_gov_n##i.partyid  [aw=weight],  cluster(id)
margins partyid, at(t_gov_n=(0(1)1)) vsquish
marginsplot, yline(0) recast(line) recastci(rarea)

*K1 plot new
gen t_gov_nxpartyid=t_gov_n*partyid
reg conf t_gov_n partyid t_gov_nxpartyid  [aw=weight],  cluster(id)
grinter t_gov_n, inter(t_gov_nxpartyid) const02(partyid)

eststo govn

reg conf i.t_gov_io_p##i.partyid  [aw=weight],  cluster(id)
eststo goviop

reg conf i.t_gov_io_n##i.partyid  [aw=weight],  cluster(id)
eststo govion

reg conf i.t_cso_gov_p##i.partyid  [aw=weight],  cluster(id)
eststo csogovp

reg conf i.t_cso_gov_n##i.partyid  [aw=weight],  cluster(id)
eststo csogovn

esttab govp govn goviop govion csogovp csogovn ///
 using tableK1-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars




*2.	credibility for national government, z=trust in government

tab govc

reg conf i.t_gov_p##c.govc  [aw=weight],  cluster(id)
eststo govp

gen t_gov_nxgovc=t_gov_n*govc
reg conf t_gov_n govc t_gov_nxgovc  [aw=weight],  cluster(id)
grinter t_gov_n, inter(t_gov_nxgovc) const02(govc)
eststo govn

reg conf i.t_gov_io_p##c.govc  [aw=weight],  cluster(id)
eststo goviop

reg conf i.t_gov_io_n##c.govc  [aw=weight],  cluster(id)
eststo govion

reg conf i.t_cso_gov_p##c.govc  [aw=weight],  cluster(id)
eststo csogovp

reg conf i.t_cso_gov_n##c.govc  [aw=weight],  cluster(id)
eststo csogovn

esttab govp govn goviop govion csogovp csogovn ///
 using tableK2-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars




*3.	all, z=political awareness proxies

tab discuss
tab edu


set more off

reg conf i.t_cso_p##c.discuss   [aw=weight],  cluster(id)
eststo csop

reg conf i.t_cso_n##c.discuss  [aw=weight],  cluster(id)
eststo cson

reg conf i.t_io_p##c.discuss  [aw=weight],  cluster(id)
eststo iop

reg conf i.t_io_n##c.discuss  [aw=weight],  cluster(id)
eststo ion

reg conf i.t_gov_p##c.discuss  [aw=weight],  cluster(id)
eststo govp

reg conf i.t_gov_n##c.discuss  [aw=weight],  cluster(id)
eststo govn

reg conf i.t_cso_io_p##c.discuss   [aw=weight],  cluster(id)
eststo csoiop

reg conf i.t_cso_io_n##c.discuss  [aw=weight],  cluster(id)
eststo csoion

reg conf i.t_gov_io_p##c.discuss  [aw=weight],  cluster(id)
eststo goviop

reg conf i.t_gov_io_n##c.discuss  [aw=weight],  cluster(id)
eststo govion

reg conf i.t_cso_gov_p##c.discuss  [aw=weight],  cluster(id)
eststo csogovp

reg conf i.t_cso_gov_n##c.discuss  [aw=weight],  cluster(id)
eststo csogovn



esttab csop cson iop ion govp govn ///
 using tableK3-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars

esttab csoiop csoion goviop govion csogovp csogovn  ///
 using tableK3contd-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars




reg conf i.t_in_p##c.discuss  [aw=weight], cluster(id)
eststo inp

reg conf i.t_in_n##c.discuss  [aw=weight], cluster(id)
eststo inn

reg conf i.t_out_p##c.discuss  [aw=weight], cluster(id)
eststo outp

reg conf i.t_out_n##c.discuss  [aw=weight], cluster(id)
eststo outn

reg conf i.t_in_out_p##c.discuss  [aw=weight], cluster(id)
eststo inoutp

reg conf i.t_in_out_n##c.discuss  [aw=weight], cluster(id)
eststo inoutn


esttab inp inn outp outn inoutp inoutn ///
 using tableK4-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars



reg conf i.t_p##c.discuss  [aw=weight],  cluster(id)
eststo pos

reg conf i.t_n##c.discuss  [aw=weight],  cluster(id)
eststo neg

reg conf i.t_pn##c.discuss [aw=weight], cluster(id)
eststo posneg 



esttab pos neg posneg ///
 using tableK5-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars




set more off

reg conf i.t_cso_p##c.edu   [aw=weight],  cluster(id)
eststo csop

reg conf i.t_cso_n##c.edu  [aw=weight],  cluster(id)
eststo cson

reg conf i.t_io_p##c.edu  [aw=weight],  cluster(id)
eststo iop

reg conf i.t_io_n##c.edu  [aw=weight],  cluster(id)
eststo ion

reg conf i.t_gov_p##c.edu  [aw=weight],  cluster(id)
eststo govp

reg conf i.t_gov_n##c.edu  [aw=weight],  cluster(id)
eststo govn

reg conf i.t_cso_io_p##c.edu   [aw=weight],  cluster(id)
eststo csoiop

reg conf i.t_cso_io_n##c.edu  [aw=weight],  cluster(id)
eststo csoion

reg conf i.t_gov_io_p##c.edu  [aw=weight],  cluster(id)
eststo goviop

reg conf i.t_gov_io_n##c.edu  [aw=weight],  cluster(id)
eststo govion

reg conf i.t_cso_gov_p##c.edu  [aw=weight],  cluster(id)
eststo csogovp

reg conf i.t_cso_gov_n##c.edu  [aw=weight],  cluster(id)
eststo csogovn



esttab csop cson iop ion govp govn ///
 using tableK6-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars

esttab csoiop csoion goviop govion csogovp csogovn  ///
 using tableK7contd-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars




reg conf i.t_in_p##c.edu  [aw=weight], cluster(id)
eststo inp

reg conf i.t_in_n##c.edu  [aw=weight], cluster(id)
eststo inn

reg conf i.t_out_p##c.edu  [aw=weight], cluster(id)
eststo outp

reg conf i.t_out_n##c.edu  [aw=weight], cluster(id)
eststo outn

reg conf i.t_in_out_p##c.edu  [aw=weight], cluster(id)
eststo inoutp

reg conf i.t_in_out_n##c.edu  [aw=weight], cluster(id)
eststo inoutn


esttab inp inn outp outn inoutp inoutn ///
 using tableK8-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars



reg conf i.t_p##c.edu  [aw=weight],  cluster(id)
eststo pos

reg conf i.t_n##c.edu  [aw=weight],  cluster(id)
eststo neg

reg conf i.t_pn##c.edu [aw=weight], cluster(id)
eststo posneg 



esttab pos neg posneg ///
 using tableK9-weighted.rtf,  scalars(N) replace ///
b(%9.3f) t(%9.3f) starlevels(* .05 ** .01 *** .001) nodepvars


